package cn.shujuhai.cms.domain;

import cn.shujuhai.common.domain.BaseDomain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @TableName recipient
 */
@EqualsAndHashCode(callSuper = true)
@TableName(value = "recipient")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Recipient extends BaseDomain {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     *
     */
    @NotNull(message = "收件人邮箱不能为空")
    @ExcelProperty("邮箱")
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     *
     */
    @ExcelProperty("姓名")
    @Size(min = 1, max = 20, message = "姓名的长度必须在1～20之间")
    private String name;

    /**
     *
     */
    @ExcelProperty("电话")
    @Pattern(regexp = "^[0-9]{11}$", message = "手机号码格式不正确")
    private String phone;

    @TableField(exist = false)
    private Long groupId;

}